﻿<UserControl x:Class="ModernUIApp1.Pages.Home"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid Style="{StaticResource ContentRoot}">
        <ScrollViewer>
            <StackPanel MinWidth="200">
                <TextBlock Text="Last runs" />
                <ListView Margin="10" Name="runsNews">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <WrapPanel>
                                <TextBlock Text="Start " />
                                <TextBlock Name="startDate" Text="{Binding startDate}" />
                                <TextBlock Text=" || End: " />
                                <TextBlock Name="endDate" Text="{Binding endDate}" />
                            </WrapPanel>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                    <ListView.Resources>
                        <ControlTemplate x:Key="SelectedTemplate" TargetType="ListViewItem">
                            <Border CornerRadius="5" BorderThickness="1" BorderBrush="DarkGray" Background="#FF92C6F9" Padding="2" HorizontalAlignment="Left" Margin="5" Tag="{Binding Value}" Cursor="Hand" >
                                <WrapPanel>
                                    <TextBlock Text="Start " />
                                    <TextBlock Text="{Binding startDate}" />
                                    <TextBlock Text=" || End: " />
                                    <TextBlock Text="{Binding endDate}" />
                                </WrapPanel>
                            </Border>
                        </ControlTemplate>
                        <Style TargetType="ListViewItem">
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="ListViewItem">
                                        <Border CornerRadius="5" BorderThickness="1" BorderBrush="DarkGray" Background="WhiteSmoke" Padding="2" HorizontalAlignment="Left" Margin="5" Tag="{Binding Value}" Cursor="Hand" >
                                            <WrapPanel>
                                                <TextBlock Text="Start " />
                                                <TextBlock Text="{Binding startDate}" />
                                                <TextBlock Text=" || End: " />
                                                <TextBlock Text="{Binding endDate}" />
                                            </WrapPanel>
                                        </Border>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                            <Style.Triggers>
                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsSelected" Value="true" />
                                        <Condition Property="Selector.IsSelectionActive" Value="true" />
                                    </MultiTrigger.Conditions>
                                    <Setter Property="Template" Value="{StaticResource SelectedTemplate}" />
                                </MultiTrigger>
                            </Style.Triggers>
                        </Style>
                    </ListView.Resources>
                </ListView>
            </StackPanel>
        </ScrollViewer>
    </Grid>
</UserControl>
